import { Component, OnInit } from '@angular/core';
import { Hero } from './../hero';
import { HeroService } from './../hero.service'

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: ['./dashboard.component.css'],
  providers: [HeroService],
})
export class DashboardComponent implements OnInit {

  constructor(private heroService:HeroService){ }
  title='dashboard';
  heroes:Hero[];

  getHeroes(): void {
    this.heroService.getHeroesAsync().then(heroes => this.heroes = heroes);
  }

  ngOnInit() {
    this.getHeroes();
  }

}
